import {
  switchInfo,
  workerSignOut
} from "../../assets/js/sign.js"

Page({
  data: {
    nurseInformationOne: {
      key: "头像",
      value: "/assets/img/left.png",
    },
    nurseInformationTwo: {
      key: "姓名",
      value: "张三"
    },
    nurseInformationThree: {
      key: "工号",
      value: "0392842"
    },
    nurseInformationFour: {
      key: "联系方式",
      value: "13927272727"
    },
    nurseInformationFive: {
      key: "登录密码",
      value: ""
    }
  },
  onLoad: function(options) {},
  onReady: function() {},
  onShow: function(options) {
    this.setUserInfo();
  },
  // 切换身份
  onSwitechInfo() {
    switchInfo();
  },
  // 职工退出登录
  onWorderSignOut() {
    workerSignOut();
  },
  // 设置用户信息
  setUserInfo() {
    let userInfo = wx.getStorageSync("userInfo");
    this.setData({
      nurseInformationOne: {
        key: "头像",
        value: "/assets/img/left.png",
      },
      nurseInformationTwo: {
        key: "姓名",
        value: userInfo.userName || "未知"
      },
      nurseInformationThree: {
        key: "工号",
        value: userInfo.jobNumber || "未知"
      },
      nurseInformationFour: {
        key: "联系方式",
        value: userInfo.phone || "未知"
      },
      nurseInformationFive: {
        key: "登录密码",
        value: ""
      }
    })
  },
  // 跳转修改联系方式
  toUpdatePhone: function() {
    wx.navigateTo({
      url: "/pages/n_updatePhone/n_updatePhone"
    })
  },
  // 跳转修改登录密码
  toUpdatePassword: function() {
    wx.navigateTo({
      url: "/pages/n_updatePassword/n_updatePassword",
    })
  },
  handleClickone: function() {
    // console.log("点击头像")
  }
})